#pragma once
struct xDeviceSettings;
#include "../../../dxhead/dxegheader.h"
#include "../../../mylib.h"
#include "../../tools/inc/xDevice.h"

namespace Sky
{
	typedef enum _RenderLIb_
	{
		Render_GDI,
		Render_DX9,
		Render_DX10,
		Render_OPENGL,
	}RenderLIb;

	struct xState
	{
		
		TBool m_bEnvCreated;
		TBool m_bWindowCreated;
		TBool m_bDeviceCreated;
		TBool m_bCreateEnvCalled;
		TBool m_bCreateWindowCalled;
		TBool m_bCreateDeviceCalled;

		TDouble	m_TimeOfApp;			//in seconds
		TFloat	m_TimeOfElapsed;		//time elapsed since last frame
		TInt	m_TimePauseCount;		//the times of timer was paused.
		TInt	m_RenderPauseCount;		//the times of render was paused
		
		TBool	m_bMinimizedWhileFullScreen;
		TBool	m_bClipCursorWhenFullScreen;
		TBool	m_bShowCursorWhenFullScreen;

		
		TBool m_ShowMsgOnError;

		//TInt  m_WinStartX;		// if > -1, then override to this X position of the window
		//TInt  m_WinStartY;			// if > -1, then override to this Y position of the window
		//TInt  m_ClientWidth;		// if > 0, then override to this width
		//TInt  m_ClientHeight;		// if > 0, then override to this height

		TVoid* m_ContextIsDeviceAcceptable;
		TVoid* m_ContextModifyDeviceSettings;

		//LPXCALLBACKISDEVICEACCEPTABLE	m_FuncIsDeviceAcceptable;   // is device acceptable callback
		//LPXCALLBACKMODIFYDEVICESETTINGS	m_FuncModifyDeviceSettings; // modify device settings callback

		TVoid* m_ContextObjectCreate;
		TVoid* m_ContextObjectReset;
		TVoid* m_ContextObjectLost;
		TVoid* m_ContextObjectDestroy;
		TVoid* m_ContextFrameMove;
		TVoid* m_ContextObjectRender;

		TBool  m_b3DObjectCreated;		//<--->m_OnDeviceCreated;m_OnDeviceDestroyed
		TBool  m_b3DObjectReseted;		//<--->m_OnDeviceReset;m_OnDeviceLost
		
		TBool  m_bDeviceLost;
		TBool  m_bActive;
		TBool  m_bMinimized;
		TBool  m_bWindowed;

		/*HWND	m_hWnd;*/
		TBool	m_bNotifyOnMouseMove;

		//------------------------------------------------------------------------------------
		//if =0  , successfully exit
		//if >0  , application used;
			// if=0x7ffff ,break break main loop
		//if <0  , user defined;
		//------------------------------------------------------------------------------------
		ExitCode m_ExitCode;
		TInt	 m_hr;
	};
}